
import React, { useState } from "react";
import {Layout} from "antd";
import { logout } from "../../api/oss/login";
import { useHistory } from "react-router";
const {Header} = Layout;
const HeaderContent = (props)=>{
  const [role,setRole] = useState("管理员")
  const history = useHistory();    
  const dologout = ()=>{
    logout().then((res=>{
      localStorage.removeItem("ossToken")
      history.push("/")
    }))
  }
        return( 
        <Header className="header">
        <div className="logo" />
        <div style={{float:"right",color:"white"}}>
          <span>欢迎,{role}</span>
          <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
          <span>修改密码</span>
          <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
          <span style={{ cursor: "pointer"}} onClick={dologout}>退出</span>
        </div>
      </Header>
      )
    
}

export default HeaderContent;